<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
	<%@page import="com.framework.entity.Global"%>
<%@ page import="com.biz.utils.ConfigUtil" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
    String resoursUrl = ConfigUtil.get("RESOURCES_URL");
%>

<!doctype html>
<html class="no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>我的收藏</title>
<meta name="description" content="">
<meta name="keywords" content="">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta name="renderer" content="webkit">
<meta http-equiv="Cache-Control" content="no-siteapp" />
<meta name="format-detection" content="telephone=no" />
<jsp:include page="/jsp/inc_head.jsp"></jsp:include>
<style>
</style>
</head>

<body style="padding-bottom:150px;">
<div class="am-g" id="collectionlist">
	


</div>



<div class="am-g mysc_fadebtm">
	<div class="am-u-sm-12 am-pad-none mysc_popchose">
    	<div class="am-u-sm-6 am-text-right" style="padding-right:30px;">
        	<img onclick="cancelcollection();" src="<%=resoursUrl%>resources/assets/image/sc_cancelsc.png"/>&nbsp;<br/>取消收藏
        </div>
        <div class="am-u-sm-6" style="padding-left:30px" >
        	<img onClick="doPopshare();" src="<%=resoursUrl%>resources/assets/image/sc_share.png"/><br/>&nbsp;&nbsp;&nbsp;分享
        </div>
    </div>
    <div class="am-u-sm-12 am-text-center mysc_btmbtn">
    	取消
    </div>
    <input id="hidid" type="hidden"/>
    <input id="hidpic" type="hidden"/>
    <input id="hidurl" type="hidden"/>
</div>

<div class="popsharepic">
	<img src="<%=resoursUrl%>resources/assets/image/sc_sharepic.png" width="100%" height="100%"/>
</div>

<jsp:include page="/jsp/inc_bottom.jsp"></jsp:include>

<div class="am-modal am-modal-alert" tabindex="-1" id="my-alert">
	<div class="am-modal-dialog">
		<div class="am-modal-hd" id="alert_title">哎呦喂，出错啦</div>
		<div class="am-modal-bd" id="alert_message"></div>
		<div class="am-modal-footer">
			  <span class="am-modal-btn">确定</span>
		</div>
	</div>
</div>
<script>
var ajaxpath="${pageContext.request.contextPath}";

$(function (){
    queryMycollection();
});

function queryMycollection(){
    var url=ajaxpath+"/userCenter/queryMycollection.do";
	$.get(url,function(data){
		var html="";
		$.each(data,function(i){
			 html+='<div class="am-u-sm-12 mysc_lie" id="collectnum'+data[i].id+'">'+
			       '<div class="am-u-sm-3 am-pad-none mysc_pic">'+
			       '<img onclick="toGoodsDetail(\''+data[i].goodsid+'\');" src="<%=Global.OSSURL%>/'+data[i].path+'"/>'+
			       '</div>'+
			       '<div class="am-u-sm-9 am-pad-none">'+
			       '<div class="am-u-sm-12 am-pad-none">'+
			       '<div class="am-u-sm-10 am-pad-none">'+
			       '<div class="mysc_flwname"  onclick="toGoodsDetail(\''+data[i].goodsid+'\');" >'+data[i].name+'</div>';
			       if(data[i].isTicket=='0'){
			       html+='<div class="flw_size">【久零商品】</div>';
			       }else{
			       html+='<div class="flw_size">【联盟商品】</div>';
			       }
			       
			  html+='</div>'+
			       '<div class="am-u-sm-2 am-pad-none am-text-right sc_morepop" >'+
			       //'<img src="<%=resoursUrl%>resources/assets/image/mysc_more.png" width="20" />'+
			       '</div>'+
			       '</div>'+
			       '<div class="am-u-sm-12 am-pad-none">'+
			       '<div class="am-u-sm-7 am-pad-none">';
			        if(data[i].isTicket=='0'){
			           html+='<span class="sc_price">'+data[i].minprice+'券点</span>';
			         }else{
			           html+='<span class="sc_price">￥'+data[i].minprice+'</span>';
			         }
			  html+='</div>'+
			       '<div class="am-u-sm-5 am-pad-none am-text-right">'+
			       //'<span class="sc_num">分享：'+data[i].countnumber+'</span>'+
			       '</div>'+
			       '</div>'+
			       '</div>'+
			       '</div>';
		});
		$("#collectionlist").html(html);
	});

}

function showmore(id,path){
	$(".mysc_fadebtm").show();	
    $("#hidid").val(id);
    $("#hidpic").val(path);
}

//取消收藏
function cancelcollection(){
      var id=$("#hidid").val();
      var url=ajaxpath+"/userCenter/deleteCollection.do?id="+id;
      $.get(url, function(data) {
		       if(data.result=="success"){
		       		$("#collectnum"+id).remove();
		       		$(".mysc_fadebtm").hide();	
		       }else {
		            $("#alert_message").html("取消收藏失败！");
		            $("#my-alert").modal('open');
		       }
	   });
}

$(".mysc_btmbtn").click(function(){
	$(".mysc_fadebtm").hide();	
});

//跳转商品详情页
function toGoodsDetail(goodsid){
    window.location.href=ajaxpath+"/client_toGoodsdetail.do?goodsid="+goodsid+"&stype="+0;
}

//分享
function doPopshare(){
    var id=$("#hidid").val();
    var pic=$("#hidpic").val();
    //url暂时没有
    var url=$("#hidurl").val();
	$(".popsharepic").show();	
}
</script>
</body>
</html>
